/**
File: Define.h
Description:
Include base system libraries
Define new type of variable
Define some base marcoes
Define some limit range
*/

#ifndef __G_DEFINE_H__
#define __G_DEFINE_H__

//System includes
#include <stdio.h>

//Release buffer memory

#define SAFE_DEL(p)						if(p){delete p; p = NULL;}
#define SAFE_DEL_ARRAY(pa)				if(pa){delete[] pa; pa = NULL;}
#define SAFE_DEL_ARRAY_POINTER(n,pap)	if(pap){for(int i=0; i<n; i++){if(pap[i]){delete pap[i]; pap[i] = NULL;}} delete[] pap; pap = NULL;}

//Success code
#define	FW_SUCCESS			0x0
//Error code
#define	FW_ERR_OPEN			-0x900
#define	FW_ERR_READ			-0x901
#define	FW_ERR_WRITE		-0x902
#define	FW_ERR_FORMAT		-0x903
#define FW_ERR_TYPE			-0x904
#define FW_ERR_NO_DATA		-0x905

//Define variable type

typedef unsigned char		FWubyte;
typedef signed char			FWbyte;
typedef unsigned short		FWushort;
typedef signed short		FWshort;
typedef	unsigned int		FWuint;
typedef signed int			FWint;
typedef unsigned long		FWulong;
typedef signed long			FWlong;
typedef unsigned long long	FWullong;
typedef signed long long	FWllong;

typedef	float				FWfloat;
typedef double				FWdouble;

typedef bool				FWboolean;

typedef void*				FWobject;

//Link list random rate
#define MAX_RAND	1000

//Max char lenght
#define MAX_LENGTH	256

//Keyboard structure
struct KeyBoard
{
	char key;
	FWboolean status;
};

struct Cursor
{
	FWfloat x;
	FWfloat y;
	FWboolean status;
};

#endif